\documentclass[border=5pt]{standalone}
\usepackage{pgfplots}
\usepackage{amsmath}
\pgfplotsset{compat=1.18}

\begin{document}
	\begin{tikzpicture}
		\begin{axis}[
			axis lines = middle,
			xlabel = $x$,
			ylabel = $y$,
			xmin = 0.5, xmax = 3.5,
			ymin = -0.5, ymax = 10,
			xtick = {1,2,3},
			ytick = \empty,
			xticklabels = {$a$,$\xi$,$b$},
			width = 10cm,
			height = 8cm,
			clip = false
			]
			% 绘制函数曲线
			\addplot[thick, domain=0.7:3.3, smooth] {x^2};
			\node[above left] at (2,8) {$y = f(x)$}; % 左上角位置
			
			% 定义关键点
			\coordinate (A) at (1,1);
			\coordinate (B) at (3,9);
			\coordinate (C) at (2,4);
			
			% 绘制AB连线（弦）
			\draw[dashed] (A) -- (B) node[midway, above left] {弦 $AB$};
			
			% 绘制切线
			\draw[red, very thick] (1.5,2) -- (2.5,6) 
			node[pos=0.9, above] {$C$点切线};
			
			% 标记关键点（点C标签位置稍微下移）
			\fill (A) circle (2.5pt) node[below left] {$A$};
			\fill (B) circle (2.5pt) node[above right] {$B$};
			\fill (C) circle (2.5pt) node[below left, yshift=-1pt] {$C$}; % 修改位置
			
			% 添加虚线投影
			\draw[dotted, thick] (A) -- (1,0);
			\draw[dotted, thick] (B) -- (3,0);
			\draw[dotted, thick] (C) -- (2,0);
			
			% 添加定理说明
			%\node[below] at (2,-1.5) 
			%{拉格朗日中值定理：$f'(\xi) = \dfrac{f(b)-f(a)}{b-a} = \dfrac{9-1}{3-1} = 4$};
			
			% 添加平行标记
			\draw[gray, ->, >=stealth] 
			(1.5,3) -- (2.5,7) 
			node[midway, above, sloped] {\footnotesize 斜率相同};
		\end{axis}
	\end{tikzpicture}
\end{document}